package com.swq.java.code.chapter15.code15;

public class GenderTest {
    enum Gender {FEMALE, MALE}//定义了一个Gender内部类

    public static void main(String[] args) {
        //遍历Gender类的所有常量
        for (Gender g : Gender.values())
            System.out.println(g.ordinal() + " " + g.name());

        Gender g = Gender.FEMALE;
        switch (g) {
            case FEMALE:
                System.out.println("女性");
                break;
            case MALE:
                System.out.println("男性");
                break;
            default:
                System.out.println("未知的性别");
        }
    }
}